package com.atguigu.day05.test;

/**
 * @version 1.0
 * @Author 马冰
 * @Date 2024/11/4 9:11
 * @注释 数组的默认值
 */
public class ArrayTest01 {
    public static void main(String[] args) {
        //定义静态数组
        int[] num = {1,2,3,4,5};
        int[] num2 = new int[]{1,2,3,4,5};
        System.out.println("num.length = " + num.length);
        System.out.println("num2.length = " + num2.length);
        System.out.println("num[2] = " + num[2]);
        System.out.println("num2[2] = " + num2[2]);
        //输出各个数据类型数组的默认值
        String[] s = new String[4];
        System.out.println("s[0] = " + s[0]);
        char[] c = new char[4];
        System.out.println("c[1] = " + c[1]);
        int[] i = new int[4];
        System.out.println("i[0] = " + i[0]);
        long[] l = new long[4];
        System.out.println("l[0] = " + l[0]);
        float[] f = new float[4];
        System.out.println("f[0] = " + f[0]);
        double[] d = new double[4];
        System.out.println("d[0] = " + d[0]);
        boolean[] b = new boolean[4];
        System.out.println("b[0] = " + b[0]);
        short[] sh = new short[4];
        System.out.println("sh[0] = " + sh[0]);
        byte[] by = new byte[4];
        System.out.println("by[0] = " + by[0]);
    }
}
